Skip to content

fix(muse-proxy): exec fallback turn deadline + kill escalation (#2159) - #4242

Merged
dezren39 merged 3 commits into
mainfrom
queue/5196-2159-exec-turn-deadline
Nov 2, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/5196-2159-exec-turn-deadline

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #2159 (queue task 5196; contract pinned by triage task 3184).

What

The exec fallback settled a request only when its muse exec child closed, with no turn deadline — a hung child wedged the request forever and leaked the process; the only kill was a bare SIGTERM on client disconnect.

Tests

node --test bin/muse-proxy.test.mjs — 40/40 pass, including 6 new #2159 tests with stub children: never-exiting child killed at a 300ms deadline (500 + timeout message + prompt file gone); streaming gets the SSE-framed error + [DONE]; SIGTERM-ignoring child SIGKILLed after the grace; completed-then-hangs child reported as a timeout failure, not a stop; a normal child inside the deadline is unaffected; client disconnect kills the child via the shared helper.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 06:54
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7e76410-891a-4255-96d2-58a3699dc5a0
Commits

Reviewing files that changed from the base of the PR and between 9456d01 and 890c547.

Files selected for processing: 2
  • bin/muse-proxy.mjs
  • bin/muse-proxy.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T14:58:52.032497Z 890c547 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 500edffb06

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/muse-proxy.mjs Resolved
@dezren39

dezren39 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

Worker note (task 5196, lane E): Codex P2 finding is valid and will be fixed on resume — parseExecTurnTimeoutMs must also reject values above 2147483647 (Node timer max) with the same warn-and-default path, plus an e2e test starting the proxy with MUSE_PROXY_EXEC_TURN_TIMEOUT_MS=2147483648 and asserting a normal child still succeeds. Task 5196 is parked until 2026-11-02T07:17Z; the resuming claim should apply this fix before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71c424214c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/muse-proxy.mjs Resolved
…d close (#2159)

Codex P2 on PR #4242: a descendant inheriting the child's stdio pipes delays Node's child close event indefinitely, so a timed-out request never settled and its prompt file was never unlinked. The close handler is now a settle-once settleRequest; the deadline arms an independent settle just past the kill grace (SIGKILL path still settles via close first) that destroys the pipes, settles with the timeout failure, and runs prompt-file cleanup. Regression test: stub child spawns an inheriting-pipe descendant — the request settles at deadline+grace+1s with the child dead and the prompt file removed. node --test bin/muse-proxy.test.mjs: 36/36 pass on the laptop.
@dezren39
dezren39 merged commit 537c0b1 into main Nov 2, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5196-2159-exec-turn-deadline branch November 2, 2026 14:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 890c547ba5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/muse-proxy.mjs
Comment on lines +1999 to +2002
if (settled) return;
settled = true;
clearTimeout(deadlineTimer);
if (settleTimer) clearTimeout(settleTimer);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Settle streaming responses when spawning the child fails

For streaming requests, an asynchronous spawn failure such as ENOENT or EACCES now leaves the HTTP request pending indefinitely. The SSE headers have already been set, so the existing !res.headersSent branch does not end the response; setting settled = true also prevents the subsequent close handler from emitting the SSE error, and clearing the deadline removes the remaining settlement path. I reproduced this with an executable whose interpreter is missing: the parent commit returns an SSE error plus [DONE], whereas this commit hangs past the configured deadline. Route this error through emitFailure for streaming responses before marking settlement complete.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

muse-proxy: exec fallback path has no turn deadline — a hung muse exec child hangs the request forever

1 participant